<?php
/**
 * SBInsightsKeywordInsight
 *
 * PHP version 5
 *
 * @category Class
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */

/**
 * Sponsored Brands campaign management
 *
 * Create and manage Sponsored Brands campaigns.   To learn more about Sponsored Brands campaigns, see:   - [Sponsored Brands overview](guides/sponsored-brands/overview)  - [Sponsored Brands campaign structure](guides/sponsored-brands/campaigns/structure)  - [Get started with Sponsored Brands campaigns](guides/sponsored-brands/campaigns/get-started-with-campaigns)
 *
 * OpenAPI spec version: 4.0
 * 
 * Generated by:https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api.git
 * AmazonAdvertisingApi Codegen version: 3.0.51
 */
/**
 * NOTE: This class is auto generated by the AmazonAdvertisingApi code generator program.
 *https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 * Do not edit the class manually.
 */

namespace AmazonAdvertisingApi\Model;

use \ArrayAccess;
use \AmazonAdvertisingApi\ObjectSerializer;

/**
 * SBInsightsKeywordInsight Class Doc Comment
 *
 * @category Class
 * @description Insights for keywords selected for targeting.
 * @package  AmazonAdvertisingApi
 * @author   vv_guo
 * @link    https://gitee.com/HuaLiLiDeDiDiao/amazon-advertising-api
 */
class SBInsightsKeywordInsight implements ModelInterface, ArrayAccess
{
    const DISCRIMINATOR = null;

    /**
      * The original name of the model.
      *
      * @var string
      */
    protected static $AmazonAdvertisingApiModelName = 'SBInsightsKeywordInsight';

    /**
      * Array of property to type mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiTypes = [
        'alerts' => '\AmazonAdvertisingApi\Model\SBInsightsKeywordAlertType[]',
        'search_term_impression_share' => 'double',
        'match_type' => '\AmazonAdvertisingApi\Model\SBInsightsMatchType',
        'ad_group_index' => 'int',
        'search_term_impression_rank' => 'int',
        'bid' => 'double',
        'keyword_index' => 'int',
        'keyword_text' => 'string'
    ];

    /**
      * Array of property to format mappings. Used for (de)serialization
      *
      * @var string[]
      */
    protected static $AmazonAdvertisingApiFormats = [
        'alerts' => null,
        'search_term_impression_share' => 'double',
        'match_type' => null,
        'ad_group_index' => null,
        'search_term_impression_rank' => null,
        'bid' => 'double',
        'keyword_index' => null,
        'keyword_text' => null
    ];

    /**
     * Array of property to type mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiTypes()
    {
        return self::$AmazonAdvertisingApiTypes;
    }

    /**
     * Array of property to format mappings. Used for (de)serialization
     *
     * @return array
     */
    public static function AmazonAdvertisingApiFormats()
    {
        return self::$AmazonAdvertisingApiFormats;
    }

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @var string[]
     */
    protected static $attributeMap = [
        'alerts' => 'alerts',
        'search_term_impression_share' => 'searchTermImpressionShare',
        'match_type' => 'matchType',
        'ad_group_index' => 'adGroupIndex',
        'search_term_impression_rank' => 'searchTermImpressionRank',
        'bid' => 'bid',
        'keyword_index' => 'keywordIndex',
        'keyword_text' => 'keywordText'
    ];

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @var string[]
     */
    protected static $setters = [
        'alerts' => 'setAlerts',
        'search_term_impression_share' => 'setSearchTermImpressionShare',
        'match_type' => 'setMatchType',
        'ad_group_index' => 'setAdGroupIndex',
        'search_term_impression_rank' => 'setSearchTermImpressionRank',
        'bid' => 'setBid',
        'keyword_index' => 'setKeywordIndex',
        'keyword_text' => 'setKeywordText'
    ];

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @var string[]
     */
    protected static $getters = [
        'alerts' => 'getAlerts',
        'search_term_impression_share' => 'getSearchTermImpressionShare',
        'match_type' => 'getMatchType',
        'ad_group_index' => 'getAdGroupIndex',
        'search_term_impression_rank' => 'getSearchTermImpressionRank',
        'bid' => 'getBid',
        'keyword_index' => 'getKeywordIndex',
        'keyword_text' => 'getKeywordText'
    ];

    /**
     * Array of attributes where the key is the local name,
     * and the value is the original name
     *
     * @return array
     */
    public static function attributeMap()
    {
        return self::$attributeMap;
    }

    /**
     * Array of attributes to setter functions (for deserialization of responses)
     *
     * @return array
     */
    public static function setters()
    {
        return self::$setters;
    }

    /**
     * Array of attributes to getter functions (for serialization of requests)
     *
     * @return array
     */
    public static function getters()
    {
        return self::$getters;
    }

    /**
     * The original name of the model.
     *
     * @return string
     */
    public function getModelName()
    {
        return self::$AmazonAdvertisingApiModelName;
    }



    /**
     * Associative array for storing property values
     *
     * @var mixed[]
     */
    protected $container = [];

    /**
     * Constructor
     *
     * @param mixed[] $data Associated array of property values
     *                      initializing the model
     */
    public function __construct(array $data = null)
    {
        $this->container['alerts'] = isset($data['alerts']) ? $data['alerts'] : null;
        $this->container['search_term_impression_share'] = isset($data['search_term_impression_share']) ? $data['search_term_impression_share'] : null;
        $this->container['match_type'] = isset($data['match_type']) ? $data['match_type'] : null;
        $this->container['ad_group_index'] = isset($data['ad_group_index']) ? $data['ad_group_index'] : null;
        $this->container['search_term_impression_rank'] = isset($data['search_term_impression_rank']) ? $data['search_term_impression_rank'] : null;
        $this->container['bid'] = isset($data['bid']) ? $data['bid'] : null;
        $this->container['keyword_index'] = isset($data['keyword_index']) ? $data['keyword_index'] : null;
        $this->container['keyword_text'] = isset($data['keyword_text']) ? $data['keyword_text'] : null;
    }

    /**
     * Show all the invalid properties with reasons.
     *
     * @return array invalid properties with reasons
     */
    public function listInvalidProperties()
    {
        $invalidProperties = [];

        return $invalidProperties;
    }

    /**
     * Validate all the properties in the model
     * return true if all passed
     *
     * @return bool True if all properties are valid
     */
    public function valid()
    {
        return count($this->listInvalidProperties()) === 0;
    }


    /**
     * Gets alerts
     *
     * @return \AmazonAdvertisingApi\Model\SBInsightsKeywordAlertType[]
     */
    public function getAlerts()
    {
        return $this->container['alerts'];
    }

    /**
     * Sets alerts
     *
     * @param \AmazonAdvertisingApi\Model\SBInsightsKeywordAlertType[] $alerts alerts
     *
     * @return $this
     */
    public function setAlerts($alerts)
    {
        $this->container['alerts'] = $alerts;

        return $this;
    }

    /**
     * Gets search_term_impression_share
     *
     * @return double
     */
    public function getSearchTermImpressionShare()
    {
        return $this->container['search_term_impression_share'];
    }

    /**
     * Sets search_term_impression_share
     *
     * @param double $search_term_impression_share The account-level ad-attributed impression share for the search-term / keyword. Provides percentage share of all ad impressions the advertiser has for the keyword in the last 7 days. This metric helps advertisers identify potential opportunities based on their share of relevant keywords. This information is only available for keywords the advertiser targeted with ad impressions. Only available in the following marketplaces: US, CA, MX, UK, DE, FR, ES, IT, IN, JP.
     *
     * @return $this
     */
    public function setSearchTermImpressionShare($search_term_impression_share)
    {
        $this->container['search_term_impression_share'] = $search_term_impression_share;

        return $this;
    }

    /**
     * Gets match_type
     *
     * @return \AmazonAdvertisingApi\Model\SBInsightsMatchType
     */
    public function getMatchType()
    {
        return $this->container['match_type'];
    }

    /**
     * Sets match_type
     *
     * @param \AmazonAdvertisingApi\Model\SBInsightsMatchType $match_type match_type
     *
     * @return $this
     */
    public function setMatchType($match_type)
    {
        $this->container['match_type'] = $match_type;

        return $this;
    }

    /**
     * Gets ad_group_index
     *
     * @return int
     */
    public function getAdGroupIndex()
    {
        return $this->container['ad_group_index'];
    }

    /**
     * Sets ad_group_index
     *
     * @param int $ad_group_index Correlates the ad group to the ad group array index specified in the request. Zero-based.
     *
     * @return $this
     */
    public function setAdGroupIndex($ad_group_index)
    {
        $this->container['ad_group_index'] = $ad_group_index;

        return $this;
    }

    /**
     * Gets search_term_impression_rank
     *
     * @return int
     */
    public function getSearchTermImpressionRank()
    {
        return $this->container['search_term_impression_rank'];
    }

    /**
     * Sets search_term_impression_rank
     *
     * @param int $search_term_impression_rank The account-level ad-attributed impression rank for the search-term / keyword. Provides the [1:N] place the advertiser ranks among all advertisers for the keyword by ad impressions in a marketplace in the last 7 days. It tells an advertiser how many advertisers had higher share of ad impressions. This information is only available for keywords the advertiser targeted with ad impressions. Only available in the following marketplaces: US, CA, MX, UK, DE, FR, ES, IT, IN, JP.
     *
     * @return $this
     */
    public function setSearchTermImpressionRank($search_term_impression_rank)
    {
        $this->container['search_term_impression_rank'] = $search_term_impression_rank;

        return $this;
    }

    /**
     * Gets bid
     *
     * @return double
     */
    public function getBid()
    {
        return $this->container['bid'];
    }

    /**
     * Sets bid
     *
     * @param double $bid The associated bid. Note that this value must be less than the budget associated with the Advertiser account. For more information, see [supported features](https://advertising.amazon.com/API/docs/v2/guides/supported_features).
     *
     * @return $this
     */
    public function setBid($bid)
    {
        $this->container['bid'] = $bid;

        return $this;
    }

    /**
     * Gets keyword_index
     *
     * @return int
     */
    public function getKeywordIndex()
    {
        return $this->container['keyword_index'];
    }

    /**
     * Sets keyword_index
     *
     * @param int $keyword_index Correlates the keyword to the keyword array index specified in the request. Zero-based.
     *
     * @return $this
     */
    public function setKeywordIndex($keyword_index)
    {
        $this->container['keyword_index'] = $keyword_index;

        return $this;
    }

    /**
     * Gets keyword_text
     *
     * @return string
     */
    public function getKeywordText()
    {
        return $this->container['keyword_text'];
    }

    /**
     * Sets keyword_text
     *
     * @param string $keyword_text The keyword text. Maximum of 10 words.
     *
     * @return $this
     */
    public function setKeywordText($keyword_text)
    {
        $this->container['keyword_text'] = $keyword_text;

        return $this;
    }
    /**
     * Returns true if offset exists. False otherwise.
     *
     * @param integer $offset Offset
     *
     * @return boolean
     */
    #[\ReturnTypeWillChange]
    public function offsetExists($offset)
    {
        return isset($this->container[$offset]);
    }

    /**
     * Gets offset.
     *
     * @param integer $offset Offset
     *
     * @return mixed
     */
    #[\ReturnTypeWillChange]
    public function offsetGet($offset)
    {
        return isset($this->container[$offset]) ? $this->container[$offset] : null;
    }

    /**
     * Sets value based on offset.
     *
     * @param integer $offset Offset
     * @param mixed   $value  Value to be set
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetSet($offset, $value)
    {
        if (is_null($offset)) {
            $this->container[] = $value;
        } else {
            $this->container[$offset] = $value;
        }
    }

    /**
     * Unsets offset.
     *
     * @param integer $offset Offset
     *
     * @return void
     */
    #[\ReturnTypeWillChange]
    public function offsetUnset($offset)
    {
        unset($this->container[$offset]);
    }

    /**
     * Gets the string presentation of the object
     *
     * @return string
     */
    public function __toString()
    {
        if (defined('JSON_PRETTY_PRINT')) { // use JSON pretty print
            return json_encode(
                ObjectSerializer::sanitizeForSerialization($this),
                JSON_PRETTY_PRINT
            );
        }

        return json_encode(ObjectSerializer::sanitizeForSerialization($this));
    }
}
